Mixed Models 3
Humboldt-Universität zu Berlin
2024-01-12
Today we will learn…
this lecture covers
we will be using the data from Biondo et al. (2022)
df_biondo <-
read_csv(here("data", "Biondo.Soilemezidi.Mancini_dataset_ET.csv"),
locale = locale(encoding = "Latin1") ## for special characters in Spanish
) |>
clean_names() |>
mutate(gramm = ifelse(gramm == "0", "ungramm", "gramm")) |>
mutate_if(is.character,as_factor) |> # all character variables as factors
droplevels() |>
filter(adv_type == "Deic")mean) and the by-participant intercepts from fit_fp_1 and fit_fp_item
sum_shrinkage <- df_biondo |>
filter(roi == 4) |>
summarise(mean = mean(log(fp), na.rm = T),
.by = "sj") |>
mutate(population_mean = mean(mean, na.rm = T)) |>
left_join(coef(fit_fp_1)$sj["(Intercept)"] |> rownames_to_column(var = "sj")) |>
rename(intercept_1 = `(Intercept)`) |>
left_join(coef(fit_fp_item)$sj["(Intercept)"] |> rownames_to_column(var = "sj")) |>
rename(intercept_item = `(Intercept)`)
sum_shrinkage |>
head() # A tibble: 6 × 5
sj mean population_mean intercept_1 intercept_item
<chr> <dbl> <dbl> <dbl> <dbl>
1 1 6.42 5.96 6.40 6.40
2 2 5.79 5.96 5.79 5.80
3 07 5.87 5.96 5.87 5.87
4 09 5.78 5.96 5.78 5.78
5 10 6.67 5.96 6.62 6.62
6 11 5.91 5.96 5.91 5.92
model sj intercept verb_t1 gramm1 verb_t1:gramm1
1 No pooling 1 6.422811 0.16094962 0.07844247 0.12950513
2 No pooling 2 5.792669 0.10115512 -0.10571656 -0.23199316
3 No pooling 07 5.870556 0.15344172 -0.25264603 -0.29866189
4 No pooling 09 5.780839 0.16938275 0.14074977 -0.07324559
5 No pooling 10 6.664530 0.04786447 -0.13824470 0.21824110
6 No pooling 11 5.912309 0.07573670 -0.06469794 0.35318406
# A tibble: 6 × 6
model sj intercept verb_t1 gramm1 `verb_t1:gramm1`
<chr> <fct> <dbl> <dbl> <dbl> <dbl>
1 Complete pooling 1 5.96 0.0612 0.00310 -0.0152
2 Complete pooling 2 5.96 0.0612 0.00310 -0.0152
3 Complete pooling 07 5.96 0.0612 0.00310 -0.0152
4 Complete pooling 09 5.96 0.0612 0.00310 -0.0152
5 Complete pooling 10 5.96 0.0612 0.00310 -0.0152
6 Complete pooling 11 5.96 0.0612 0.00310 -0.0152
Figure 2: Elaine Benes learns about shrinkage of random effect estimates towards the population-level estimates